package com.exam.online.system.dao;

import com.exam.online.system.entity.QuestionStuPaper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface QuestionStuPaperDAO {
    int deleteByPrimaryKey(Integer id);

    int insert(QuestionStuPaper record);

    int insertSelective(QuestionStuPaper record);

    QuestionStuPaper selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(QuestionStuPaper record);

    int updateByPrimaryKey(QuestionStuPaper record);

    @Select("select * from `t_question_stu_paper` where stu_id = #{stuId} and paper_id = #{paperId}")
    List<QuestionStuPaper> findByStuIdAndPaperId(@Param("stuId") Integer stuId, @Param("paperId") Integer paperId);

    @Select("select * from `t_question_stu_paper` where stu_id = #{stuId} and paper_id = #{paperId} and question_id = #{questionId}")
    QuestionStuPaper selectByPaperIdAndStuIdAndQuestionId(@Param("paperId") Integer paperId, @Param("stuId") Integer stuId, @Param("questionId") Integer questionId);
}